

using System;
using System.Text;

using NHibernate;
using NHibernate.Cfg;
using NHibernate.Criterion;
using NHibernate.Exceptions;

using SpotifyGenNHibernate.EN.Spotify;
using SpotifyGenNHibernate.CAD.Spotify;

namespace SpotifyGenNHibernate.CEN.Spotify
{
        public partial class RadioCEN
        {
        private IRadioCAD _IRadioCAD;

        public RadioCEN(IRadioCAD _IRadioCAD)
        {
                this._IRadioCAD = _IRadioCAD;
        }

        public String CrearRadio (String p_IdRadio, int p_Epoca, String p_Estilo, System.Collections.Generic.IList<int> p_artista)
        {
                RadioEN radioEN = null;
                String oid;

                //Initialized RadioEN
                radioEN = new RadioEN ();
                radioEN.IdRadio = p_IdRadio;
                radioEN.Epoca = p_Epoca;
                radioEN.Estilo = p_Estilo;
                if (p_artista != null) {
                        radioEN.Artista = new System.Collections.Generic.List<SpotifyGenNHibernate.EN.Spotify.ArtistaEN>();
                        foreach (int item in p_artista) {
                                SpotifyGenNHibernate.EN.Spotify.ArtistaEN en = new SpotifyGenNHibernate.EN.Spotify.ArtistaEN ();
                                en.IdArtista = item;
                                radioEN.Artista.Add (en);
                        }
                }
                //Call to RadioCAD

                oid = _IRadioCAD.CrearRadio (radioEN);
                return oid;
        }

        public void BorrarRadio (String IdRadio)
        {
                _IRadioCAD.BorrarRadio (
                        IdRadio

                        );
        }

        public RadioEN ObtenerRadio (String IdRadio)
        {
                RadioEN radioEN = null;

                radioEN = _IRadioCAD.ObtenerRadio (
                        IdRadio

                        );
                return radioEN;
        }

        public void AñadirArtista (String p_Radio_OID, System.Collections.Generic.IList<int> p_artista_OIDs)
        {
                //Call to RadioCAD

                _IRadioCAD.AñadirArtista (p_Radio_OID, p_artista_OIDs);
        }
        public void EliminarArtista (String p_Radio_OID, System.Collections.Generic.IList<int> p_artista_OIDs)
        {
                //Call to RadioCAD

                _IRadioCAD.EliminarArtista (p_Radio_OID, p_artista_OIDs);
        }
        }
}
